﻿@model GameSchoolApplication.Models.Game

@{
    ViewBag.Title = "Nánar um leik";
	Layout = "~/Views/Shared/_AdministratorLayout.cshtml";
}
<section id="MainContent">
<h2>Nánar um leik</h2>

<fieldset>
    <legend></legend>

    <div class="display-label">Nafn:</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.Title)
    </div><br />

    <div class="display-label">Lýsing:</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.Description)
    </div><br />

    <div class="display-label">Höfundur:</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.Author.Name)
    </div><br />
</fieldset>
</section>
<table class="IndexTable">
    <caption>Kennarar</caption>
    @if (Model.GameInstructors.Count == 0)
    { 
        <tr><td>Engir kennarar skráðir</td></tr>
    }
    else
    { 
        <tr>
            <th>Nafn</th>
            <th>Netfang</th>
            <th>&nbsp;</th>
        </tr>
        foreach (var instructor in Model.GameInstructors)
        { 
            <tr>
                <td>@instructor.Teacher.Name</td>
                <td><a href="mailto:@instructor.Teacher.Email">@instructor.Teacher.Email</a></td>
                 <td>
                    @using (Html.BeginForm("RemoveTeacherFromGame", "Game")) 
                    {
                        @Html.Hidden("instructorId", @instructor.Id)
                        <input type="submit" value="Skrá úr leik" />
                    }
                </td>
            </tr>
        }
    }
</table>

<table class="IndexTable">
    <caption>Nemendur</caption>
    @if (Model.Enrollments.Count == 0)
    { 
        <tr><td>Engir nemendur skráðir</td></tr>
    }
    else
    { 
        <tr>
            <th>Nafn</th>
            <th>Netfang</th>
            <th>&nbsp;</th>
        </tr>
        foreach (var enrollment in Model.Enrollments)
        { 
            <tr>
                <td>@enrollment.Student.Name</td>
                <td><a href="mailto:@enrollment.Student.Email">@enrollment.Student.Email</a></td>
                <td>
                    @using (Html.BeginForm("RemoveStudentFromGame", "Game")) 
                    {
                        @Html.Hidden("enrollmentId", @enrollment.EnrollmentId)
                        <input type="submit" value="Skrá úr leik" />
                    }
                </td>
            </tr>
        }
    }
</table>
<p>
    @Html.ActionLink("Skrá kennara í leik", "AddTeacherToGame", new { id = Model.GameId }) |
    @Html.ActionLink("Skrá nemanda í leik", "AddStudentToGame", new { id = Model.GameId }) |
	@Html.ActionLink("Breyta", "Edit", new { id = Model.GameId }) |
    @Html.ActionLink("Til baka í lista", "Index")
</p>
